﻿/******************************************************************************
 *  Author：       Commscope ITDC Suzhou Web Team 
 *  CreateDate：   21/02/2012 2:29:00 PM
 *
 *
 ******************************************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI;

namespace EasyDLL.Web
{
    public class ScriptWrapper
    {
        /// <summary>
        /// 显示消息提示对话框
        /// </summary>
        /// <param name="page">当前页面指针，一般为this</param>
        /// <param name="msg">提示信息</param>
        public static void ShowAlert(Page page, string msg)
        {
            page.ClientScript.RegisterStartupScript(page.GetType(), "message", string.Format("alert('{0}')", msg), true);
        }

        /// <summary>
        /// 显示消息提示对话框，并进行页面跳转
        /// </summary>
        /// <param name="page">当前页面指针，一般为this</param>
        /// <param name="msg">提示信息</param>
        /// <param name="url">跳转的目标URL</param>
        public static void ShowAlertAndRedirect(Page page, string msg, string url)
        {
            page.ClientScript.RegisterStartupScript(page.GetType(), "message", string.Format("alert('{0}');window.location='{1}'", msg, url), true);
        }
    }
}
